<?xml version="1.0" encoding="utf-8"?>
<DbSchema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	        version="27">

	<table name="download_topics">
		<column name="id" 
		        type="Integer"
		        auto-increment="true"
		        seed="1"
		        increment="1"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="source"
		        type="NCharacterVaring"
		        nullable="true"
		        size="32"/>
		<column name="messageid"
		        type="Integer"
		        nullable="false" size="4"
		        decimal-precision="10" />
		<column name="hint"
		        type="NCharacterVaring"
		        nullable="true"
		        size="128"/>
		<key name="PK_download_topics"
		     columns="id"
		     key-type="KeyPrimary"
		     clustered="true" />
	</table>

	<table name="favorites">
		<column name="id"
		        type="Integer"
		        auto-increment="true"
		        seed="1"
		        increment="1"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="mid"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="fid"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="comment"
		        type="NCharacterVaring"
		        nullable="true"
		        size="255"/>
		<column name="url"
		        type="BlobSubtypeNText"
		        nullable="true"
		        size="8"/>
		<key name="PK_favorites"
		     columns="id"
		     key-type="KeyPrimary"
		     clustered="true" />
	</table>

	<table name="favorites_folders">
		<column name="id"
		        type="Integer"
		        auto-increment="true"
		        seed="1"
		        increment="1"
		        nullable="false" 
		        size="4"
		        decimal-precision="10" />
		<column name="name"
		        type="NCharacterVaring" 
		        nullable="true"
		        size="100"/>
		<column name="pid"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="comment"
		        type="NCharacterVaring"
		        nullable="true"
		        size="255"/>
		<key name="PK_favorites_folders"
		     columns="id"
		     key-type="KeyPrimary"
		     clustered="true" />
	</table>

	<table name="marks_outbox">
		<column name="id"
		        type="Integer"
		        auto-increment="true"
		        seed="1"
		        increment="1"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="mark"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="mid"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<key name="PK_marks_outbox"
		     columns="id"
		     key-type="KeyPrimary"
		     clustered="true" />
	</table>

	<table name="messages">
		<column name="dte"
		        type="Timestamp"
		        nullable="false"
		        size="4"/>
		<column name="gid"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="ismarked"
		        type="Boolean"
		        default-value="0"
		        nullable="false"
		        size="1"/>
		<column name="isread"
		        type="TinyInt"
		        default-value="0"
		        nullable="false"
		        size="1"
		        decimal-precision="3" />
		<column name="message"
		        type="BlobSubtypeNText"
		        nullable="true"
		        size="8"/>
		<column name="mid"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="pid"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="subject"
		        type="NCharacterVaring"
		        nullable="true"
		        size="128"/>
		<column name="tid"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="uclass"
		        type="Integer"
		        nullable="true"
		        size="4"
		        decimal-precision="10" />
		<column name="uid"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="usernick"
		        type="NCharacterVaring"
		        nullable="true"
		        size="50"/>
		<column name="article_id"
		        type="Integer"
		        nullable="true"
		        size="4"
		        decimal-precision="10" />
		<column name="readreplies"
		        type="Boolean"
		        default-value="0"
		        nullable="false"
		        size="1"/>
		<column name="name" 
		        type="NCharacterVaring"
		        nullable="true"
		        size="160"/>
		<column name="lastModerated"
		        type="Timestamp"
		        nullable="true"
		        size="4"/>
		<column name="closed"
		        type="Boolean"
		        default-value="0"
		        nullable="false"
		        size="1"/>
		<index name="IX_messages_dte"
		       columns="dte"
		       clustered="false"
		       allow-nulls="Allow"
		       unique="false"/>
		<index name="IX_messages_gid"
		       columns="gid"
		       clustered="false"
		       allow-nulls="Allow"
		       unique="false"/>
		<index name="IX_messages_pid"
		       columns="pid"
		       clustered="false"
		       allow-nulls="Allow"
		       unique="false"/>
		<index name="IX_messages_tid"
		       columns="tid"
		       clustered="false"
		       allow-nulls="Allow"
		       unique="false"/>
		<index name="IX_messages_uid"
		       columns="uid"
		       clustered="false"
		       allow-nulls="Allow"
		       unique="false"/>
		<key name="PK_messages"
		     columns="mid"
		     key-type="KeyPrimary"
		     clustered="true" />
	</table>

	<table name="messages_outbox">
		<column name="dte" 
		        type="Timestamp"
		        nullable="false"
		        size="8"/>
		<column name="gid"
		        type="Integer"
		        nullable="true"
		        size="4"
		        decimal-precision="10" />
		<column name="hold"
		        type="Boolean"
		        default-value="0"
		        nullable="false"
		        size="1"/>
		<column name="message"
		        type="BlobSubtypeNText"
		        nullable="true"
		        size="8"/>
		<column name="mid"
		        type="Integer"
		        auto-increment="true"
		        seed="1"
		        increment="1"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="reply"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="subject"
		        type="NCharacterVaring"
		        nullable="true"
		        size="128"/>
		<column name="tagline"
		        type="NCharacterVaring"
		        nullable="true"
		        size="128"/>
		<key name="PK_messages_outbox"
		     columns="mid"
		     key-type="KeyPrimary"
		     clustered="true" />
	</table>

	<table name="rate_outbox">
		<column name="id"
		        type="Integer"
		        auto-increment="true"
		        seed="1"
		        increment="1"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="mid"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="rate"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<key name="PK_rate_outbox"
		     columns="id"
		     key-type="KeyPrimary"
		     clustered="true" />
	</table>

	<table name="rating">
		<column name="dte"
		        type="Timestamp"
		        nullable="false"
		        size="8" />
		<column name="id"
		        type="Integer"
		        auto-increment="true"
		        seed="1"
		        increment="1"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="mid"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="rate"
		        type="SmallInt"
		        nullable="false"
		        size="2"
		        decimal-precision="5" />
		<column name="rby"
		        type="SmallInt"
		        nullable="false"
		        size="2"
		        decimal-precision="5" />
		<column name="tid"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="uid"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<index name="IX_rating_mid"
		       columns="mid"
		       clustered="false"
		       allow-nulls="Allow"
		       unique="false"/>
		<index name="IX_rating_mid_rate"
		       columns="mid, rate"
		       clustered="false"
		       allow-nulls="Allow"
		       unique="false"/>
		<index name="IX_rating_tid"
		       columns="tid"
		       clustered="false"
		       allow-nulls="Allow"
		       unique="false"/>
		<index name="IX_rating_uid"
		       columns="uid"
		       clustered="false"
		       allow-nulls="Allow"
		       unique="false"/>
		<key name="PK_rating"
		     columns="id"
		     key-type="KeyPrimary"
		     clustered="true" />
	</table>

	<table name="server_forums" type="Table">
		<column name="descript"
		        type="NCharacterVaring"
		        nullable="true"
		        size="128"/>
		<column name="id"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="name"
		        type="NCharacterVaring"
		        nullable="true"
		        size="64"/>
		<column name="rated"
		        type="Boolean"
		        default-value="0"
		        nullable="false"
		        size="1"/>
		<column name="intop"
		        type="Boolean"
		        default-value="0"
		        nullable="false"
		        size="1"/>
		<column name="ratelimit"
		        type="SmallInt"
		        nullable="false"
		        size="2"
		        decimal-precision="5" />
		<index name="IX_server_forums_name"
		       columns="name"
		       clustered="false"
		       allow-nulls="Allow"
		       unique="false"/>
		<key name="PK_server_forums"
		     columns="id"
		     key-type="KeyPrimary"
		     clustered="true" />
	</table>

	<table name="subscribed_forums">
		<column name="descript"
		        type="NCharacterVaring"
		        nullable="true"
		        size="128"/>
		<column name="id"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="lastsync"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="name"
		        type="NCharacterVaring" 
		        nullable="true"
		        size="64"/>
		<column name="urcount"
		        type="Integer"
		        nullable="true"
		        size="4"
		        decimal-precision="10"/>
		<column name="issync"
		        type="Boolean"
		        default-value="0"
		        nullable="false"
		        size="1"/>
		<column name="priority"
		        type="Integer"
		        nullable="true"
		        size="4"
		        decimal-precision="10" />
		<index name="IX_subscribed_forums_name"
		       columns="name"
		       clustered="false"
		       allow-nulls="Allow"
		       unique="false"/>
		<key name="PK_subscribed_forums"
		     columns="id"
		     key-type="KeyPrimary"
		     clustered="true" />
	</table>

	<table name="topic_info">
		<column name="mid"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="answers_count" 
		        type="SmallInt"
		        nullable="true"
		        size="2"
		        decimal-precision="5" />
		<column name="answers_unread" 
		        type="SmallInt"
		        nullable="true"
		        size="2" 
		        decimal-precision="5" />
		<column name="answers_rate" 
		        type="SmallInt"
		        nullable="true"
		        size="2" 
		        decimal-precision="5" />
		<column name="answers_smile" 
		        type="SmallInt"
		        nullable="true"
		        size="2"
		        decimal-precision="5" />
		<column name="answers_agree"
		        type="SmallInt"
		        nullable="true"
		        size="2"
		        decimal-precision="5" />
		<column name="answers_disagree"
		        type="SmallInt"
		        nullable="true"
		        size="2"
		        decimal-precision="5" />
		<column name="answers_me_unread"
		        type="SmallInt"
		        nullable="true"
		        size="2"
		        decimal-precision="5" />
		<column name="answers_marked"
		        type="SmallInt"
		        nullable="true"
		        size="2"
		        decimal-precision="5" />
		<column name="answers_last_update_date"
		        type="Timestamp"
		        nullable="true"
		        size="8"/>
		<column name="answers_mod_count"
		        type="SmallInt"
		        nullable="true" 
		        size="2"
		        decimal-precision="5" />
		<column name="this_rate"
		        type="SmallInt"
		        nullable="true"
		        size="2"
		        decimal-precision="5" />
		<column name="this_smile"
		        type="SmallInt"
		        nullable="true"
		        size="2"
		        decimal-precision="5" />
		<column name="this_agree"
		        type="SmallInt"
		        nullable="true"
		        size="2"
		        decimal-precision="5" />
		<column name="this_disagree"
		        type="SmallInt"
		        nullable="true"
		        size="2"
		        decimal-precision="5" />
		<column name="this_mod_count"
		        type="SmallInt"
		        nullable="true"
		        size="2"
		        decimal-precision="5" />
		<column name="gid"
		        type="Integer"
		        nullable="true"
		        size="4"
		        decimal-precision="10" />
		<index name="IX_ti_answers_last"
		       columns="answers_last_update_date"
		       clustered="false"
		       allow-nulls="Allow"
		       unique="false"/>
		<index name="IX_topic_info_gid"
		       columns="gid"
		       clustered="false"
		       allow-nulls="Allow"
		       unique="false"/>
		<key name="PK_topic_info"
		     columns="mid"
		     key-type="KeyPrimary"
		     clustered="true" />
		<key name="FK_topic_info_mid"
		     columns="mid"
		     key-type="KeyForeign"
		     rel-table="messages"
		     rel-columns="mid"
		     clustered="false" />
	</table>

	<table name="users">
		<column name="uid"
		        type="Integer"
		        nullable="false"
		        size="4"
		        decimal-precision="10" />
		<column name="homepage" 
		        type="NCharacterVaring"
		        nullable="true"
		        size="120"/>
		<column name="origin"
		        type="NCharacterVaring"
		        nullable="true"
		        size="255"/>
		<column name="publicemail"
		        type="NCharacterVaring"
		        nullable="true"
		        size="60"/>
		<column name="realname"
		        type="NCharacterVaring"
		        nullable="true"
		        size="80"/>
		<column name="spec"
		        type="NCharacterVaring"
		        nullable="true"
		        size="100"/>
		<column name="userclass"
		        type="Integer"
		        nullable="true"
		        size="4"
		        decimal-precision="10" />
		<column name="username"
		        type="NCharacterVaring"
		        nullable="true"
		        size="60"/>
		<column name="usernick"
		        type="NCharacterVaring"
		        nullable="true"
		        size="100"/>
		<column name="wherefrom"
		        type="NCharacterVaring"
		        nullable="true"
		        size="100"/>
		<key name="PK_users"
		     columns="uid"
		     key-type="KeyPrimary"
		     clustered="true" />
	</table>

	<table name="vars">
		<column name="name" 
		        type="NCharacterVaring" 
		        nullable="false" 
		        size="24"/>
		<column name="varvalue" 
		        type="NCharacterVaring" 
		        nullable="true"
		        size="128"/>
		<key name="PK_vars"
		     columns="name"
		     key-type="KeyPrimary"
		     clustered="true" />
	</table>

	<table name="moderatorials">
		<column name="messageId"
		        type="Integer"
		        auto-increment="false"
		        seed="0" increment="0"
		        nullable="false"
		        size="4"
		        decimal-scale="0"
		        decimal-precision="10" />
		<column name="userId" 
		        type="Integer" 
		        nullable="false" 
		        size="4"
		        decimal-precision="10" />
		<column name="forumId" 
		        type="Integer" 
		        nullable="false" 
		        size="4" 
		        decimal-precision="10" />
		<column name="create" 
		        type="Timestamp" 
		        nullable="false" 
		        size="4" 
		        decimal-precision="0" />
		<key name="PK_moderatorials"
		     columns="messageId, userId"
		     key-type="KeyPrimary"
		     clustered="true" />
		<index name="IX_moderatorials_messageId"
		       columns="messageId" 
		       clustered="false"
		       allow-nulls="Allow"
		       unique="false"/>
		<index name="IX_moderatorials_userId"
		       columns="userId"
		       clustered="false"
		       allow-nulls="Allow"
		       unique="false"/>
		<index name="IX_moderatorials_create"
		       columns="create"
		       clustered="false"
		       allow-nulls="Allow"
		       unique="false"/>
	</table>
</DbSchema>